<template>
  <div>
    <TypeNav></TypeNav>
    <ListContainer></ListContainer>
    <Recommend></Recommend>
    <Rank />
    <Like />
    <!-- 
      父子组件通信:props
      Home组件:如果Home组件的数据没有,看不见Floor子组件的，
      如果Home组件内部能看见Floor，父亲数据回来了，儿子的结构渲染完毕（才能看见）
     -->
    <Floor v-for="(floor) in floorList" :key="floor.id" :floor="floor"/>
    <Brand />
  </div>
</template>
<script>
//引入
import ListContainer from "./ListContainer";
import Recommend from "./Recommend";
import Rank from "./Rank";
import Like from "./Like";
import Floor from "./Floor";
import Brand from "./Brand";
import { mapState } from 'vuex';
export default {
  name: "Home",
  //注册组件
  components: {
    ListContainer,
    Recommend,
    Rank,
    Like,
    Floor,
    Brand,
  },
  mounted() {
    //派发action获取floor的数据
    this.$store.dispatch("getFloorList");

  },
  //获取仓库数据
  computed:{
    ...mapState({
       floorList:state=>state.home.floorList
    })
  }
};
</script>

<style scoped>
</style>
